<?php
include("../connection/connection.php");
include("reportFunctions.php");
$distId=$_REQUEST['distId'];
$sqlReport = "SELECT distinct district_id,district_name FROM `tbl_lookup_location` where district_id = '".$distId."'";
$queryReport = mysql_query($sqlReport);
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Report</title>
</head>
<body>
<table border="0" width="800" cellspacing="0" cellpadding="0">
	<tr>
		<td bgcolor="#E9E9E9" height="26">
		<p align="center">
		<font face="Verdana" style="font-size: 9pt; font-weight: 700" color="#224568">
		Percentage of constraints faced by PHED </font>
		<div align="center"><span style="font-size: 9pt; font-weight: 700">
	        <font face="Verdana" color="#224568"> Table 29 </font></span></div></td>
	</tr>
	<tr>
		<td bgcolor="#E9E9E9" height="56">
		<table border="1" width="800" cellspacing="0" cellpadding="0" height="49">
			<tr bgcolor="#C5D8EB">
				<td width="119" rowspan="2" align="center">
				<p align="center"><font face="Verdana" style="font-size: 8.5pt">
				Name of district</font></td>
				<td colspan="3" align="center"  width="119">
				<p align="center"><font face="Verdana" style="font-size: 8.5pt">
				Type of constraints </font></td>
				<td width="130" rowspan="2" align="center">
				<p align="center"><font face="Verdana" style="font-size: 8.5pt">
				Total </font></td>
				<td colspan="3" align="center" width="119">
				<p align="center"><font face="Verdana" style="font-size: 8.5pt">
				Percentage</font></td>
			</tr>
			<tr bgcolor="#C5D8EB">
				<td align="center" width="124">
				<font style="font-size: 8.5pt" face="Verdana">Institutional</font></td>
				<td align="center" width="127">
				<font style="font-size: 8.5pt" face="Verdana">Financial</font></td>
				<td align="center" width="119">
				<font style="font-size: 8.5pt" face="Verdana">Operational</font></td>
				<td align="center" width="119">
				<font style="font-size: 8.5pt" face="Verdana">Institutional</font></td>
				<td align="center" width="119">
				<font style="font-size: 8.5pt" face="Verdana">Financial</font></td>
				<td align="center" width="119">
				<font style="font-size: 8.5pt" face="Verdana">Operational</font></td>
			</tr>
		 <?php  	
		 
			//$numVillage=0;
			//$numFormVill=0;
			while($rowReport = mysql_fetch_array($queryReport)) {
			$a=getTotalInstitutionalDistrictWise('institutional','constraint_institutional',$rowReport['district_id']);
			$b=getTotalInstitutionalDistrictWise('financial','constraint_financial',$rowReport['district_id']);
			$c=getTotalInstitutionalDistrictWise('operational','constraint_operational',$rowReport['district_id']);
			?>
			<tr bgcolor="#FFFFFF">
				<td width="119" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo $rowReport['district_name'];?></font></td>
				<td width="124" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo getTotalInstitutionalDistrictWise('institutional','constraint_institutional',$rowReport['district_id']);?></font></td>
				<td width="127" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo getTotalInstitutionalDistrictWise('financial','constraint_financial',$rowReport['district_id']);?></font></td>
				<td align="center" width="119"><font face="Verdana" style="font-size: 8.5pt"><?php echo getTotalInstitutionalDistrictWise('operational','constraint_operational',$rowReport['district_id']);?></font></td>
				<td align="center" width="130"><font face="Verdana" style="font-size: 8.5pt"><?php echo $total=($a+$b+$c);?></font></td>
				<td align="center" width="119" ><font face="Verdana" style="font-size: 8.5pt">
				<?php 
				if($total==0)
				{
				echo "0.00";
				}else{
				echo number_format(($a/$total)*100,2,'.','');}
				?></font>				</td>
				<td align="center" width="119"><font face="Verdana" style="font-size: 8.5pt">
				<?php 
				if($total==0)
				{
				echo "0.00";
				}else{
				echo number_format(($b/$total)*100,2,'.','');}
				?></font>				</td>
				<td align="center" width="119"><font face="Verdana" style="font-size: 8.5pt">
				<?php 
				if($total==0)
				{
				echo "0.00";
				}else{
				echo number_format(($c/$total)*100,2,'.','');}
				?></font>				</td>
			</tr>
			<?php
			}
			?>
		</table>
		</td>
	</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>


</body>
</html>

